package com.atguigu.distributed.lock.leecode;

/**
 * 剑指offer剪绳子
 */
public class CutRope {
    public int cutRope(int target){
        if(target ==2||target==3){
            return target-1;
        }
        int res = 1;
        while(target>4){
            target = target-3;
            res *= 3;
        }
        return res*target;
    }

    public static void main(String[] args) {
        CutRope cutRope = new CutRope();
        int i = cutRope.cutRope(7);
        System.out.println("res==>"+i);
    }
}
